|
In object-oriented programming, the dependency inversion principle refers to a specific form of decoupling software modules. When following this principle, the conventional dependency relationships established from high-level, policy-setting modules to low-level, dependency modules are inverted (i.e. reversed), thus rendering high-level modules independent of the low-level module implementation details. The principle states: ::''A. High-level modules should not depend on low-level modules. Both should depend on abstractions.'' ::''B. Abstractions should not depend on details. Details should depend on abstractions.'' The principle ''inverts'' the way some people may think about object-oriented design, dictating that ''both'' high- and low-level objects must depend on the same abstraction. ==Traditional layers pattern== In conventional application architecture, lower-level components are designed to be consumed by higher-level components which enable increasingly complex systems to be built. In this composition, higher-level components depend directly upon lower-level components to achieve some task. This dependency upon lower-level components limits the reuse opportunities of the higher-level components. center The goal of the dependency inversion principle is to avoid this highly coupled distribution with the mediation of an abstract layer, and to increase the re-usability of higher/policy layers. 抄文引用元・出典: フリー百科事典『 ウィキペディア(Wikipedia)』 ■ウィキペディアで「Dependency inversion principle」の詳細全文を読む スポンサード リンク
|